package src.com.atguigu04.block.exer;

/**
 * ClassName: User
 * Package: src.com.atguigu04.block.exer
 * Description:
 *
 * @Author BuTang
 * @Create 2023/3/9 21:42
 * @Version 1.0
 */
public class User {
    private String userName;
    private String password;
    private long registartiontime;

    public User() {
        //System.out.println("新用户注册");
       // registartiontime = System.currentTimeMillis();
        userName =registartiontime+"";
        password = "123456";

    }
    public User(String userName, String password) {
        //   System.out.println("新用户注册");
        //registartiontime = System.currentTimeMillis();
        this.userName = userName;
        this.password = password;

    }


    /**
     * 这样可以把构造器中相同的部分，放在代码块中执行
     */
    {
        System.out.println("新用户注册");
        registartiontime = System.currentTimeMillis();
    }


    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassword() {
        return password;
    }

    public long getRegistartiontime() {
        return registartiontime;
    }
    public String getInfo(){
        return "用户名："+userName+"，密码："+password+"，注册时间："+registartiontime;
    }
}
